﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using XMK.Framework.Model;
using XMK.Tadong.Data;
using XMK.Utils;
using XMK.Tadong.Model;
using XMK.Framework.DataAccess;

namespace XMK.Tadong.Biz
{
    public class LoginUserBiz
    {
        /// <summary>
        /// 用户帐号
        /// </summary>
        /// <returns></returns>
        public static string LoginUserAccount()
        {
            return GetLoginUserInfo.USER_ACCOUNT;
        }

        public static string LoginUserID()
        {
            return GetLoginUserInfo.USER_ID;
        }

        public static string LoginUserName()
        {
            return GetLoginUserInfo.USER_NAME;
        }
        public static string LoginUserLang()
        {
            return HttpContext.Current.Session["lang"].ToString();
        }
        private static Base_UserInfo GetLoginUserInfo
        {
            get
            {
                if (HttpContext.Current.Session == null)
                {
                    throw new Exception("User does not exist");
                }
                Base_UserInfo info = new Base_UserInfo()
                {
                    USER_ACCOUNT = HttpContext.Current.Session["useraccount"].ToString(),
                    USER_CODE = HttpContext.Current.Session["usercode"].ToString(),
                    USER_ID = HttpContext.Current.Session["userid"].ToString(),
                    USER_NAME = HttpContext.Current.Session["username"].ToString()
                };
                return info;
            }
        }
    }
}
